<?php
$newThread = curl_init();
$edrpo = $_GET['edrpo'];
$full_edrpo = 'SertEdrpo='.$edrpo;

//echo 'post '.$full_edrpo;
$file = 'd:/1234.txt';

curl_setopt_array($newThread, array
    (
        CURLOPT_URL            => 'http://ukrcc.com/inc/sertificate_from_edrpo.php',
        CURLOPT_CONNECTTIMEOUT => 1,
        CURLOPT_FOLLOWLOCATION => 1,
        CURLOPT_TIMEOUT        => 10,
        CURLOPT_POST           => 1,
        CURLOPT_POSTFIELDS     => $full_edrpo,
        CURLOPT_VERBOSE        => $fp,
           
        CURLOPT_HTTPHEADER     => array
            (
            'Host: ukrcc.com',
            'Content-Type: application/octet-stream',
            'Content-Length: '.strlen($full_edrpo)
            )
     )
);

/*
$pattern [0]      = '/post JsHttpRequest.dataReady\(/';
$pattern [1]      = '/,"text":""}\)/';
$replacements [1] = '';
$replacements [0] = '';
$newThread = preg_replace($pattern, $replacements, $newThread);
*/

curl_exec($newThread);

file_put_contents($file, '');
        $fp = fopen($file,'w+b');
        curl_setopt($newThread, CURLOPT_FILE, $fp);
        curl_exec($newThread);
        $html = true;

    curl_close($newThread);
?>
